<template>
    <el-tab-pane label="风险管理" name="risk">
        <z-table title="风险管理" url="/do/select/risk_perform" :params="params" :columns="riskColumns"
                 :size="5"
                 :tabs="tabs">
            <template #header$="">
                <z-action label='上报风险' mode='dialog' :fields="riskFields" type='primary'
                          url='/api/risk/addRisk'/>
            </template>
            <template #action$="{ row }">
                <z-action label='详情' :data="row" mode='dialog' href='/contract/riskDetail' width='800px' link
                          :map="{ id: 'id' }"/>
                <z-action v-if="row.status === 0" label='解除风险' mode='dialog' :fields="riskPatchFields" link
                          :data="row" url='/do/patch/risk_lift'/>
                <z-action label='删除' mode='confirm' link :data="row" url='/do/delete/risk'/>
            </template>
        </z-table>
    </el-tab-pane>
</template>

<script>


export default {
    props: {
        params: Object,
    },
    data() {
        return {
            riskColumns: [
                {label: "风险类型", name: "type", code: "riskType"},
                {label: "风险内容", name: "content"},
                {label: "是否解除", name: "status", type: "switch"}
            ],
            tabs: {"code": "riskType", "list": [], "keyword": "type"},
            riskFields: [
                {label: "风险类型", name: "type", code: "riskType", default: 2, readonly: true},
                {label: "关联合同", name: "contractId", default: this.params.contractId, visible: false},
                {label: "风险内容", name: "content"},
                {label: "通知对象", name: "notice", type: 'user', multiple: true},
            ],
            riskPatchFields: [
                {label: "解除说明", name: "explain", type: "textarea"},
                {label: "附件", name: "file", type: "attach"},
                {label: "关联合同", name: "contractId", default: this.params.contractId, visible: false},
            ],
        }
    },
    methods: {}
}
</script>
